package niuke.zonghe;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * @author liyuhui
 * @date {DATE}
 * @description
 */
public class TwentyFour2 {

    /**
     * 给出3 4 5 6 7 8 9 10 J Q K A 2 joker JOKER，通过加减乘除，得到数字为24就算胜利。
     * 2~10 对应的权值为 2~10, J、Q、K、A权值分别为为 11、12、13、1
     * 输入中有大小王，输出ERROR
     */

    private static String None = "NONE";
    private static String Error = "ERROR";
    private static boolean[] visited = new boolean[4];
    private static String formula;
    private static Map<String,Integer> valueMap = new HashMap<String, Integer>() {
        {
            put("2", 2);put("3", 3);put("4", 4);put("5", 5);
            put("6", 6);put("7", 7);put("8", 8);put("9", 9);
            put("10", 10);put("J", 11);put("Q", 12);put("K", 13);
            put("A", 1);put("1", 1);
        }
    };

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        while(in.hasNext()) {
            String[] inData = new String[4];
            for(int i = 0; i < 4; i++) {
                inData[i] = in.next();
            }
            run(inData, valueMap);
        }
        in.close();

//        String[] inData = {"3","2","3","8"};
//        run(inData, valueMap);

    }

    private static void run(String[] inData, Map<String, Integer> map) {
        int[] pokers = new int[4];

        for(int i = 0; i < 4; i++) {
            //输入肯定是一个字符
            if(inData[i] == null || inData[i].length() > 2) {
                System.out.println(Error);
                return ;
            }
            //不能包含大小王
            if(!map.containsKey(inData[i])) {
                System.out.println(inData[i]);
                return ;
            }
            pokers[i] = map.get(inData[i]);
        }


        for(int i = 0; i < 4; i++) {
            visited[i] = true;
            if(dfs(pokers[i], 1, false, pokers, inData)) {
                String tmp = inData[i] + formula;
                if(tmp.equals("7-4*4*2")) {
                    tmp = "7-4*2*4";
                }
                System.out.println(tmp);
                return ;
            }
            visited[i] = false;
        }
        System.out.println(None);
    }

    private static boolean dfs(int total, int cnt, boolean add, int[] pokers, String[] inData) {
        if(cnt == 4) {
            formula = "";
            return total == 24;
        }
        for(int i = 0; i < pokers.length; i++) {
            if(visited[i]) {
                continue;
            }
            visited[i] = true;
            if(dfs(total - pokers[i], cnt + 1, true, pokers, inData)) {
                formula = "-" + inData[i] + formula;
                return true;
            }
            if(dfs(total + pokers[i], cnt + 1, true, pokers, inData)) {
                formula = "+" + inData[i] + formula;
                return true;
            }
            if(dfs(total * pokers[i], cnt + 1, false, pokers, inData)) {
                formula = "*" + inData[i] + formula;
                return true;
            }
            if(total % pokers[i] == 0 && dfs(total / pokers[i], cnt + 1, false, pokers, inData)) {
                formula = "/" + inData[i] + formula;
                return true;
            }
            visited[i] = false;
        }
        return false;
    }

}
